package com.ybkj.daijia.server.model;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.ybkj.daijia.common.DateTimeSerialize;
import com.ybkj.daijia.common.TimeSerialize;
import com.ybkj.daijia.server.model.OrderStatus.StatusType;
import java.math.BigDecimal;
import java.util.Date;
import java.util.LinkedList;
import java.util.List;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;

/**
 * 订单 订单状态管理, 新订单---- 预派单---- 已派单----服务中--<是否被确认?>--结算----报单 | | 申请销单 | | 已销单
 *
 * @author Shine
 */
public class Order extends Base {

    /**
     * 新订单
     */
    public static final int ORDER_STATUS_NEW = 0;
    /**
     * 已派单
     */
    public static final int ORDER_STATUS_YIPAIDAN = 1;
    /**
     * 服务中
     */
    public static final int ORDER_STATUS_BUSY = 2;
    /**
     * 订单已经结算
     */
    public static final int ORDER_STATUS_FINISHED = 3;
    /**
     * 司机拒绝，申请销单
     */
    public static final int ORDER_STATUS_REFUSED = 4;
    /**
     * 订单已经销单
     */
    public static final int ORDER_STATUS_CANCELED = 5;
    /**
     * 订单已经报单
     */
    public static final int ORDER_STATUS_BAODAN = 6;
    /**
     * 订单预派单
     */
    public static final int ORDER_STATUS_YUPAIDAN = 7;

    public static final String ORDER_MEMBER_TYPE_PASSENGER = "个人用户";

    public static final String ORDER_MEMBER_TYPE_ENTERPRISE = "企业用户";

    /**
     * 订单来源
     */
    public static final String ORDER_TYPE_PHONE = "电话预约";
    public static final String ORDER_TYPE_APP = "APP预约";
    public static final String ORDER_TYPE_WEIXIN = "微信预约";
    public static final String ORDER_TYPE_WEB = "网站预约";
    public static final String ORDER_TYPE_BUDAN = "司机补单";
    public static final String ORDER_TYPE_MANAGER = "客户经理";
    public static final String ORDER_TYPE_XCX = "小程序";

    /**
     *
     */
    private static final long serialVersionUID = 1L;

    @JsonIgnore
    private Long orderGroupId;

    private String orderNumber;

    private OrderCarType orderCarType;// 订单类型 代驾 专车

    private OrderCarTypeDetail orderCarTypeDetail;// 订单类型 详细

    private String fromPlace;// 代驾地点

    private String fromPlaceDetail;// 预约地详细地址

    private String clientName;// 客户姓名

    private String clientPhone;// 客户手机

    private String userPhone;// 使用人手机

    private Long clientId;// 客户id

    private Double clientLongitude; // 客户经度

    private Double clientLatitude; // 客户纬度

    private String toPlace;// 目的地

    private String toPlaceDetail;// 目的地详细地址

    private Double toPlaceLongitude; // 目的地经度

    private Double toPlaceLatitude; // 目的地纬度

    private Date serverTime;// 服务时间

    private String memo;// 备注

    private Integer status;// 状态 0未派单 1已派单2服务中 3已完成 5已销单 6已报单

    private String orderType;// 订单类型; 人工 司机补单 一键下单 自主预约 微信下单 客户经理下单 网站下单

    private String memberType;// 客户类型

    private String fromSource;// 来源;

    private BigDecimal shouldCash; // 应收金额

    private BigDecimal realCash; // 实收金额

    private BigDecimal baoxiaoCash;// 报销金额

    private String baoxiaoMemo;// 报销金额说明

    private boolean baoxiao;// 是否已报销

    private String driverName;// 接单司机 昵称

    private String driverRealName;// 接单司机 真实姓名

    private Long driverId;// 接单司机 id

    private String driverPhone;// 接单司机 电话

    private String driverPhoto;// 接单司机 头像

    private Double driverStarLevel;// 接单司机星级

    private Double driverLongitude; // 接单司机经度

    private Double driverLatitude; // 接单司机纬度

    private boolean hasbeenRate;// 是否已经被评价

    private String carNumber;// 车牌号

    private BigDecimal startPrice;// 起步费用

    private Double mileage;// 行驶里程(公里)

    private BigDecimal mileagePrice;// 里程费用

    private Integer waitedTime;// 等候时间（分）等候客户+中途等待

    private BigDecimal waitedPrice;// 等待费用

    private Integer waitedZtTime;// 等候时间（分）中途等待

    private Integer travelTime;// 代驾耗时（分）行驶+中途等待

    private BigDecimal travelPrice;// 行驶时间费用

    private Integer customerWaitedTime;// 等候时间（分）等候客户

    private PayType payType; // 支付方式

    private Long companyId;

    private Company company;

    private Area area;

    private List<OrderStatus> orderStatuss = new LinkedList<OrderStatus>();

    @JsonIgnore
    private String refuseMemo;// 司机拒单理由

    private Date finishTime;

    private String recording;// 录音

    private boolean hasVisited;// 是否已经回访

    /**
     * 订单状态时间
     */
    private Date acceptTime;// 派单时间(派单或补单)

    private Date lastAcceptTime;// 最后派单时间(派单或补单)

    private Date chufaTime;// 司机接受订单时间

    private Date daokehuTime;// 司机到达客户时间

    private Date daijiaTime;// 司机等待客户结束开始代驾时间 （完成时）

    private Date daijiaTime2;// 司机等待客户结束开始代驾时间 （中途）

    private Boolean ringing;// 是否派单响铃

    private String cancelContent;

    private String operating;// 完工操作人

    private boolean isRefused;// 是否司机拒过单

    private Boolean isClosed;// 催单提示框是否关闭

    private Date lasturge;// 订单上次催促时间

    /**
     * 结算新增字段
     */
    private Double discount; // 折扣

    private PayTypeDetails payTypeDetails; // 详细支付方式

    private BigDecimal couponMoney;// 优惠劵金额

    private BigDecimal cashMoney;// 现金金额

    private BigDecimal signMoney;// 签单金额

    private BigDecimal balanceMoney;// 余额金额

    private BigDecimal alipayMoney;// 支付宝金额

    private BigDecimal weixinMoney;// 微信金额

    private BigDecimal unionpayMoney;// 银联金额

    private BigDecimal bestpayMoney;// 翼支付金额

    private BigDecimal guoluMoney;// 过路费

    private BigDecimal yuanchengMoney;// 远程费

    private BigDecimal otherMoney;// 其他费

    private PayTypeDetails prePayTypeDetail; // 预支付方式

    private PayTypeDetails afterPayTypeDetail; // 后支付方式（可能无）

    private boolean treatment;// 是否已确认

    private Date treatmentDate;// 确认时间

    /**
     * 结算新增字段
     */
    private boolean hasHandelWarm;

    private boolean isFixPrice;// 是否定价

    private Insurance insurance;

    private Long couponId;// 预选的优惠券id

    private Date arrivePlaceDate;// 到达预约地时间

    private Date startDriveDate;// 开始出发时间

    private String createOrderName;

    private Double justKilometres;// 司机调价（公里数）

    private BigDecimal justMoney;// 司机调价（金额）

    private Long areaOfEmployId; // 约个师傅

    private BigDecimal djxFee;// 代驾险

    private BigDecimal ywxFee;// 意外险

    private Long managerId;// 客户经理id

    private String orderNoRenBao;// 人保俱乐部订单号

    private String cuponNoRenBao;// 人保俱乐部凭证码

    private String preferentialType;//人保俱乐部优惠类型

    public String getPreferentialType() {
        return preferentialType;
    }

    public void setPreferentialType(String preferentialType) {
        this.preferentialType = preferentialType;
    }

    public String getOrderNoRenBao() {
        return orderNoRenBao;
    }

    public void setOrderNoRenBao(String orderNoRenBao) {
        this.orderNoRenBao = orderNoRenBao;
    }

    public String getCuponNoRenBao() {
        return cuponNoRenBao;
    }

    public void setCuponNoRenBao(String cuponNoRenBao) {
        this.cuponNoRenBao = cuponNoRenBao;
    }

    public Long getManagerId() {
        return managerId;
    }

    public void setManagerId(Long managerId) {
        this.managerId = managerId;
    }

    public Long getAreaOfEmployId() {
        return areaOfEmployId;
    }

    public void setAreaOfEmployId(Long areaOfEmployId) {
        this.areaOfEmployId = areaOfEmployId;
    }

    public BigDecimal getDjxFee() {
        return djxFee;
    }

    public void setDjxFee(BigDecimal djxFee) {
        this.djxFee = djxFee;
    }

    public BigDecimal getYwxFee() {
        return ywxFee;
    }

    public void setYwxFee(BigDecimal ywxFee) {
        this.ywxFee = ywxFee;
    }

    public Double getJustKilometres() {
        if (null == justKilometres) {
            return 0d;
        }
        return justKilometres;
    }

    public void setJustKilometres(Double justKilometres) {
        this.justKilometres = justKilometres;
    }

    public BigDecimal getJustMoney() {
        if (null == justMoney) {
            return BigDecimal.ZERO;
        }
        return justMoney;
    }

    public void setJustMoney(BigDecimal justMoney) {
        this.justMoney = justMoney;
    }

    public String getCreateOrderName() {
        return createOrderName;
    }

    public void setCreateOrderName(String createOrderName) {
        this.createOrderName = createOrderName;
    }

    public BigDecimal getStartPrice() {
        if (null == startPrice) {
            return BigDecimal.ZERO;
        }
        return startPrice;
    }

    public void setStartPrice(BigDecimal startPrice) {
        this.startPrice = startPrice;
    }

    public BigDecimal getMileagePrice() {
        if (null == mileagePrice) {
            return BigDecimal.ZERO;
        }
        return mileagePrice;
    }

    public void setMileagePrice(BigDecimal mileagePrice) {
        this.mileagePrice = mileagePrice;
    }

    public BigDecimal getWaitedPrice() {
        if (null == waitedPrice) {
            return BigDecimal.ZERO;
        }
        return waitedPrice;
    }

    public void setWaitedPrice(BigDecimal waitedPrice) {
        this.waitedPrice = waitedPrice;
    }

    public BigDecimal getTravelPrice() {
        if (null == travelPrice) {
            return BigDecimal.ZERO;
        }
        return travelPrice;
    }

    public void setTravelPrice(BigDecimal travelPrice) {
        this.travelPrice = travelPrice;
    }

    public BigDecimal getGuoluMoney() {
        if (null == guoluMoney) {
            return BigDecimal.ZERO;
        }
        return guoluMoney;
    }

    public void setGuoluMoney(BigDecimal guoluMoney) {
        this.guoluMoney = guoluMoney;
    }

    public BigDecimal getYuanchengMoney() {
        if (null == yuanchengMoney) {
            return BigDecimal.ZERO;
        }
        return yuanchengMoney;
    }

    public void setYuanchengMoney(BigDecimal yuanchengMoney) {
        this.yuanchengMoney = yuanchengMoney;
    }

    public BigDecimal getOtherMoney() {
        if (null == otherMoney) {
            return BigDecimal.ZERO;
        }
        return otherMoney;
    }

    public void setOtherMoney(BigDecimal otherMoney) {
        this.otherMoney = otherMoney;
    }

    public BigDecimal getAlipayMoney() {
        if (null == alipayMoney) {
            return BigDecimal.ZERO;
        }
        return alipayMoney;
    }

    public void setAlipayMoney(BigDecimal alipayMoney) {
        this.alipayMoney = alipayMoney;
    }

    public BigDecimal getUnionpayMoney() {
        if (null == unionpayMoney) {
            return BigDecimal.ZERO;
        }
        return unionpayMoney;
    }

    public void setUnionpayMoney(BigDecimal unionpayMoney) {
        this.unionpayMoney = unionpayMoney;
    }

    public BigDecimal getBestpayMoney() {
        if (null == bestpayMoney) {
            return BigDecimal.ZERO;
        }
        return bestpayMoney;
    }

    public void setBestpayMoney(BigDecimal bestpayMoney) {
        this.bestpayMoney = bestpayMoney;
    }

    public BigDecimal getWeixinMoney() {
        if (null == weixinMoney) {
            return BigDecimal.ZERO;
        }
        return weixinMoney;
    }

    public void setWeixinMoney(BigDecimal weixinMoney) {
        this.weixinMoney = weixinMoney;
    }

    public String getFromPlaceDetail() {
        if (StringUtils.isEmpty(fromPlaceDetail)) {
            return "";
        }
        return fromPlaceDetail;
    }

    public void setFromPlaceDetail(String fromPlaceDetail) {
        this.fromPlaceDetail = fromPlaceDetail;
    }

    public String getToPlaceDetail() {
        if (StringUtils.isEmpty(toPlaceDetail)) {
            return "";
        }
        return toPlaceDetail;
    }

    public void setToPlaceDetail(String toPlaceDetail) {
        this.toPlaceDetail = toPlaceDetail;
    }

    public Boolean getIsClosed() {
        return isClosed;
    }

    public void setIsClosed(Boolean isClosed) {
        this.isClosed = isClosed;
    }

    public Date getLasturge() {
        return lasturge;
    }

    public void setLasturge(Date lasturge) {
        this.lasturge = lasturge;
    }

    public Long getOrderGroupId() {
        return orderGroupId;
    }

    public void setOrderGroupId(Long orderGroupId) {
        this.orderGroupId = orderGroupId;
    }

    public String getFromPlace() {
        if (StringUtils.isEmpty(fromPlace)) {
            return "";
        }
        return fromPlace;
    }

    public void setFromPlace(String fromPlace) {
        this.fromPlace = fromPlace;
    }

    public String getClientName() {
        return clientName;
    }

    public void setClientName(String clientName) {
        this.clientName = clientName;
    }

    public boolean isHasbeenRate() {
        return hasbeenRate;
    }

    public void setHasbeenRate(boolean hasbeenRate) {
        this.hasbeenRate = hasbeenRate;
    }

    public String getClientPhone() {
        return clientPhone;
    }

    public void setClientPhone(String clientPhone) {
        this.clientPhone = clientPhone;
    }

    public Date getServerTime() {
        return serverTime;
    }

    public void setServerTime(Date serverTime) {
        this.serverTime = serverTime;
    }

    @JsonSerialize(using = TimeSerialize.class)
    public Date getServerTimeHI() {
        return serverTime;
    }

    @JsonSerialize(using = DateTimeSerialize.class)
    public Date getServerTimeMDHI() {
        return serverTime;
    }

    public Long getClientId() {
        return clientId;
    }

    public void setClientId(Long clientId) {
        this.clientId = clientId;
    }

    public String getMemo() {
        if (StringUtils.isEmpty(memo)) {
            return "";
        }
        return memo;
    }

    public void setMemo(String memo) {
        this.memo = memo;
    }

    public Integer getStatus() {
        if (null == status) {
            return 0;
        }
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    public String getOrderType() {
        return orderType;
    }

    public void setOrderType(String orderType) {
        this.orderType = orderType;
    }

    public BigDecimal getShouldCash() {
        if (null == shouldCash) {
            return BigDecimal.ZERO;
        }
        return shouldCash;
    }

    public void setShouldCash(BigDecimal shouldCash) {
        this.shouldCash = shouldCash;
    }

    public BigDecimal getRealCash() {
        if (null == realCash) {
            return BigDecimal.ZERO;
        }
        return realCash;
    }

    public void setRealCash(BigDecimal realCash) {
        this.realCash = realCash;
    }

    public BigDecimal getBaoxiaoCash() {
        if (null == baoxiaoCash) {
            return BigDecimal.ZERO;
        }
        return baoxiaoCash;
    }

    public void setBaoxiaoCash(BigDecimal baoxiaoCash) {
        this.baoxiaoCash = baoxiaoCash;
    }

    public boolean isBaoxiao() {
        return baoxiao;
    }

    public void setBaoxiao(boolean baoxiao) {
        this.baoxiao = baoxiao;
    }

    public String getCarNumber() {
        return carNumber;
    }

    public void setCarNumber(String carNumber) {
        this.carNumber = carNumber;
    }

    public Double getMileage() {
        if (null == mileage) {
            return 0D;
        }
        return mileage;
    }

    public void setMileage(Double mileage) {
        this.mileage = mileage;
    }

    public Integer getWaitedTime() {
        if (null == waitedTime) {
            return 0;
        }
        return waitedTime;
    }

    public void setWaitedTime(Integer waitedTime) {
        this.waitedTime = waitedTime;
    }

    public Integer getWaitedZtTime() {

        return waitedZtTime;

    }

    public void setWaitedZtTime(Integer waitedZtTime) {
        this.waitedZtTime = waitedZtTime;
    }

    public Integer getCustomerWaitedTime() {
        Date start = null;
        Date end = null;
        if (!CollectionUtils.isEmpty(orderStatuss)) {
            for (OrderStatus os : orderStatuss) {
                if (os.getStatusType().equals(StatusType.daokehu)) {
                    start = os.getHappened();
                    break;
                }
            }
            for (OrderStatus os : orderStatuss) {
                if (os.getStatusType().equals(StatusType.daijia)) {
                    end = os.getHappened();
                    break;
                }
            }
        }
        if (null != start && null != end) {
            long time = end.getTime() - start.getTime();
            return (int) (time / (1000 * 60));
        }
        return 0;
    }

    public void setCustomerWaitedTime(Integer customerWaitedTime) {
        this.customerWaitedTime = customerWaitedTime;
    }

    public Integer getTravelTime() {
        if (null == travelTime) {
            return 0;
        }
        return travelTime;
    }

    public void setTravelTime(Integer travelTime) {
        this.travelTime = travelTime;
    }

    public PayType getPayType() {
        return payType;
    }

    public void setPayType(PayType payType) {
        this.payType = payType;
    }

    public List<OrderStatus> getOrderStatuss() {
        return orderStatuss;
    }

    public void setOrderStatuss(List<OrderStatus> orderStatuss) {
        this.orderStatuss = orderStatuss;
    }

    public Long getCompanyId() {
        return companyId;
    }

    public void setCompanyId(Long companyId) {
        this.companyId = companyId;
    }

    public Company getCompany() {
        return company;
    }

    public void setCompany(Company company) {
        this.company = company;
    }

    public Area getArea() {
        return area;
    }

    public void setArea(Area area) {
        this.area = area;
    }

    public String getDriverName() {
        if (StringUtils.isEmpty(driverName)) {
            return "";
        }
        return driverName;
    }

    public void setDriverName(String driverName) {
        this.driverName = driverName;
    }

    public Long getDriverId() {
        return driverId;
    }

    public void setDriverId(Long driverId) {
        this.driverId = driverId;
    }

    public String getOrderNumber() {
        return orderNumber;
    }

    public void setOrderNumber(String orderNumber) {
        this.orderNumber = orderNumber;
    }

    public String getFromSource() {
        return fromSource;
    }

    public void setFromSource(String fromSource) {
        this.fromSource = fromSource;
    }

    public Double getClientLongitude() {
        return clientLongitude;
    }

    public void setClientLongitude(Double clientLongitude) {
        this.clientLongitude = clientLongitude;
    }

    public Double getClientLatitude() {
        return clientLatitude;
    }

    public void setClientLatitude(Double clientLatitude) {
        this.clientLatitude = clientLatitude;
    }

    public String getToPlace() {
        if (StringUtils.isEmpty(toPlace)) {
            return "";
        }
        return toPlace;
    }

    public void setToPlace(String toPlace) {
        this.toPlace = toPlace;
    }

    public Double getToPlaceLongitude() {
        return toPlaceLongitude;
    }

    public void setToPlaceLongitude(Double toPlaceLongitude) {
        this.toPlaceLongitude = toPlaceLongitude;
    }

    public Double getToPlaceLatitude() {
        return toPlaceLatitude;
    }

    public void setToPlaceLatitude(Double toPlaceLatitude) {
        this.toPlaceLatitude = toPlaceLatitude;
    }

    public boolean getHasToPlace() {
        if (org.apache.commons.lang3.StringUtils.isBlank(toPlace) || null == toPlaceLongitude
            || null == toPlaceLatitude) {
            return false;
        }
        return true;
    }

    public Date getFinishTime() {
        return finishTime;
    }

    public void setFinishTime(Date finishTime) {
        this.finishTime = finishTime;
    }

    @JsonSerialize(using = TimeSerialize.class)
    public Date getFinishTimeHI() {
        return finishTime;
    }

    public String getRecording() {
        return recording;
    }

    public void setRecording(String recording) {
        this.recording = recording;
    }

    public String getRefuseMemo() {
        return refuseMemo;
    }

    public void setRefuseMemo(String refuseMemo) {
        this.refuseMemo = refuseMemo;
    }

    public String getDriverPhone() {
        if (StringUtils.isEmpty(driverPhone)) {
            return "";
        }
        return driverPhone;
    }

    public void setDriverPhone(String driverPhone) {
        this.driverPhone = driverPhone;
    }

    public Date getAcceptTime() {
        if (!CollectionUtils.isEmpty(orderStatuss)) {
            for (OrderStatus os : orderStatuss) {
                if (os.getStatusType().equals(StatusType.paidan) || os.getStatusType()
                    .equals(StatusType.budan)) {
                    return os.getHappened();
                }
            }
        }
        return null;
    }

    public void setAcceptTime(Date acceptTime) {
        this.acceptTime = acceptTime;
    }

    // public Date getLastAcceptTime() {
    // if(!CollectionUtils.isEmpty(orderStatuss)){
    // for (int i=(orderStatuss.size()-1);i>=0;i--) {
    // if(orderStatuss.get(i).getStatusType().equals(StatusType.paidan)){
    // return orderStatuss.get(i).getHappened();
    // }
    // }
    // }
    // return null;
    // }

    public void setLastAcceptTime(Date lastAcceptTime) {
        this.lastAcceptTime = lastAcceptTime;
    }

    public Date getChufaTime() {
        if (!CollectionUtils.isEmpty(orderStatuss)) {
            for (OrderStatus os : orderStatuss) {
                if (os.getStatusType().equals(StatusType.accept)) {
                    return os.getHappened();
                }
            }
        }
        return null;
    }

    public void setChufaTime(Date chufaTime) {
        this.chufaTime = chufaTime;
    }

    public Date getDaokehuTime() {
        if (!CollectionUtils.isEmpty(orderStatuss)) {
            for (OrderStatus os : orderStatuss) {
                if (os.getStatusType().equals(StatusType.daokehu)) {
                    return os.getHappened();
                }
            }
        }
        return null;
    }

    public void setDaokehuTime(Date daokehuTime) {
        this.daokehuTime = daokehuTime;
    }

    public Date getDaijiaTime() {
        if (!CollectionUtils.isEmpty(orderStatuss)) {
            for (OrderStatus os : orderStatuss) {
                if (os.getStatusType().equals(StatusType.daijia)) {
                    return os.getHappened();
                }
            }
        }
        return null;
    }

    public void setDaijiaTime(Date daijiaTime) {
        this.daijiaTime = daijiaTime;
    }

    public Date getDaijiaTime2() {
        if (!CollectionUtils.isEmpty(orderStatuss)) {
            for (OrderStatus os : orderStatuss) {
                if (os.getStatusType().equals(StatusType.daijia2)) {
                    return os.getHappened();
                }
            }
        }
        return null;
    }

    public void setDaijiaTime2(Date daijiaTime2) {
        this.daijiaTime2 = daijiaTime2;
    }

    public String getCancelContent() {
        if (!CollectionUtils.isEmpty(orderStatuss)) {
            for (OrderStatus os : orderStatuss) {
                if (os.getStatusType().equals(StatusType.xiaodan)) {
                    return os.getContent() + ":" + os.getMemo();
                }
            }
        }
        return "";
    }

    public void setCancelContent(String cancelContent) {
        this.cancelContent = cancelContent;
    }

    public Double getDriverLongitude() {
        return driverLongitude;
    }

    public void setDriverLongitude(Double driverLongitude) {
        this.driverLongitude = driverLongitude;
    }

    public Double getDriverLatitude() {
        return driverLatitude;
    }

    public void setDriverLatitude(Double driverLatitude) {
        this.driverLatitude = driverLatitude;
    }

    public String getBaoxiaoMemo() {
        if (null == baoxiaoMemo) {
            return "";
        }
        return baoxiaoMemo;
    }

    public void setBaoxiaoMemo(String baoxiaoMemo) {
        this.baoxiaoMemo = baoxiaoMemo;
    }

    public String getDriverRealName() {
        if (StringUtils.isEmpty(driverRealName)) {
            return "";
        }
        return driverRealName;
    }

    public void setDriverRealName(String driverRealName) {
        this.driverRealName = driverRealName;
    }

    public String getDriverPhoto() {
        return driverPhoto;
    }

    public void setDriverPhoto(String driverPhoto) {
        this.driverPhoto = driverPhoto;
    }

    public Double getDriverStarLevel() {
        return driverStarLevel;
    }

    public void setDriverStarLevel(Double driverStarLevel) {
        this.driverStarLevel = driverStarLevel;
    }

    public boolean isHasVisited() {
        return hasVisited;
    }

    public void setHasVisited(boolean hasVisited) {
        this.hasVisited = hasVisited;
    }

    public String getOperating() {
        return operating;
    }

    public void setOperating(String operating) {
        this.operating = operating;
    }

    public Boolean getRinging() {
        return ringing;
    }

    public void setRinging(Boolean ringing) {
        this.ringing = ringing;
    }

    public String getUserPhone() {
        if (!StringUtils.isEmpty(userPhone)) {
            return userPhone;
        } else {
            return clientPhone;
        }
    }

    public void setUserPhone(String userPhone) {
        this.userPhone = userPhone;
    }

    public boolean isRefused() {
        return isRefused;
    }

    public void setRefused(boolean isRefused) {
        this.isRefused = isRefused;
    }

    public Double getDiscount() {
        return discount;
    }

    public void setDiscount(Double discount) {
        this.discount = discount;
    }

    public PayTypeDetails getPayTypeDetails() {
        return payTypeDetails;
    }

    public void setPayTypeDetails(PayTypeDetails payTypeDetails) {
        this.payTypeDetails = payTypeDetails;
    }

    public BigDecimal getCouponMoney() {
        if (null == couponMoney) {
            return BigDecimal.ZERO;
        }
        return couponMoney;
    }

    public void setCouponMoney(BigDecimal couponMoney) {
        this.couponMoney = couponMoney;
    }

    public BigDecimal getCashMoney() {
        if (null == cashMoney) {
            return BigDecimal.ZERO;
        }
        return cashMoney;
    }

    public void setCashMoney(BigDecimal cashMoney) {
        this.cashMoney = cashMoney;
    }

    public BigDecimal getSignMoney() {
        if (null == signMoney) {
            return BigDecimal.ZERO;
        }
        return signMoney;
    }

    public void setSignMoney(BigDecimal signMoney) {
        this.signMoney = signMoney;
    }

    public BigDecimal getBalanceMoney() {
        if (null == balanceMoney) {
            return BigDecimal.ZERO;
        }
        return balanceMoney;
    }

    public void setBalanceMoney(BigDecimal balanceMoney) {
        this.balanceMoney = balanceMoney;
    }

    public String getMemberType() {
        return memberType;
    }

    public void setMemberType(String memberType) {
        this.memberType = memberType;
    }

    public boolean isHasHandelWarm() {
        return hasHandelWarm;
    }

    public void setHasHandelWarm(boolean hasHandelWarm) {
        this.hasHandelWarm = hasHandelWarm;
    }

    public boolean isFixPrice() {
        return isFixPrice;
    }

    public void setFixPrice(boolean isFixPrice) {
        this.isFixPrice = isFixPrice;
    }

    public OrderCarType getOrderCarType() {
        if (null == orderCarType) {
            return OrderCarType.daijia;
        }
        return orderCarType;
    }

    public void setOrderCarType(OrderCarType orderCarType) {
        this.orderCarType = orderCarType;
    }

    public OrderCarTypeDetail getOCarTypeDetail() {
        return orderCarTypeDetail;
    }

    public void setOrderCarTypeDetail(OrderCarTypeDetail orderCarTypeDetail) {
        this.orderCarTypeDetail = orderCarTypeDetail;
    }

    public Long getCouponId() {
        return couponId;
    }

    public void setCouponId(Long couponId) {
        this.couponId = couponId;
    }

    public Insurance getInsurance() {
        return insurance;
    }

    public void setInsurance(Insurance insurance) {
        this.insurance = insurance;
    }

    public PayTypeDetails getPrePayTypeDetail() {
        return prePayTypeDetail;
    }

    public void setPrePayTypeDetail(PayTypeDetails prePayTypeDetail) {
        this.prePayTypeDetail = prePayTypeDetail;
    }

    public PayTypeDetails getAfterPayTypeDetail() {
        return afterPayTypeDetail;
    }

    public void setAfterPayTypeDetail(PayTypeDetails afterPayTypeDetail) {
        this.afterPayTypeDetail = afterPayTypeDetail;
    }

    public boolean isTreatment() {
        return treatment;
    }

    public void setTreatment(boolean treatment) {
        this.treatment = treatment;
    }

    public Date getTreatmentDate() {
        return treatmentDate;
    }

    public void setTreatmentDate(Date treatmentDate) {
        this.treatmentDate = treatmentDate;
    }

    public Date getArrivePlaceDate() {
        return arrivePlaceDate;
    }

    public void setArrivePlaceDate(Date arrivePlaceDate) {
        this.arrivePlaceDate = arrivePlaceDate;
    }

    public Date getStartDriveDate() {
        return startDriveDate;
    }

    public void setStartDriveDate(Date startDriveDate) {
        this.startDriveDate = startDriveDate;
    }

    public String getPreAndAfterPayType() {
        if (null != prePayTypeDetail || null != afterPayTypeDetail) {
            String str = "";
            if (null != prePayTypeDetail) {
                if (prePayTypeDetail.equals(PayTypeDetails.sign)) {
                    str = "签单";
                } else if (prePayTypeDetail.equals(PayTypeDetails.balance)) {
                    str = "余额";
                } else if (prePayTypeDetail.equals(PayTypeDetails.alipay)) {
                    str = "支付宝";
                } else if (prePayTypeDetail.equals(PayTypeDetails.weixin)) {
                    str = "微信";
                } else if (prePayTypeDetail.equals(PayTypeDetails.unionpay)) {
                    str = "银联";
                } else if (prePayTypeDetail.equals(PayTypeDetails.bestpay)) {
                    str = "翼支付";
                } else if (prePayTypeDetail.equals(PayTypeDetails.coupon_sign)) {
                    str = "优惠券+签单";
                } else if (prePayTypeDetail.equals(PayTypeDetails.coupon_balance)) {
                    str = "优惠券+余额";
                } else if (prePayTypeDetail.equals(PayTypeDetails.coupon_alipay)) {
                    str = "优惠券+支付宝";
                } else if (prePayTypeDetail.equals(PayTypeDetails.coupon_weixin)) {
                    str = "优惠券+微信";
                } else if (prePayTypeDetail.equals(PayTypeDetails.coupon_unionpay)) {
                    str = "优惠券+银联";
                } else if (prePayTypeDetail.equals(PayTypeDetails.coupon_bestpay)) {
                    str = "优惠券+翼支付";
                } else if (prePayTypeDetail.equals(PayTypeDetails.coupon)) {
                    str = "优惠券";
                }
            }

            if (null != afterPayTypeDetail) {
                if (afterPayTypeDetail.equals(PayTypeDetails.helppay)) {
                    if (StringUtils.isEmpty(str)) {
                        str = "代付";
                    } else {
                        if (!str.contains("代付")) {
                            str += "+代付";
                        }
                    }
                } else if (afterPayTypeDetail.equals(PayTypeDetails.sign)) {
                    if (StringUtils.isEmpty(str)) {
                        str = "签单";
                    } else {
                        if (!str.contains("签单")) {
                            str += "+签单";
                        }
                    }
                } else if (afterPayTypeDetail.equals(PayTypeDetails.balance)) {
                    if (StringUtils.isEmpty(str)) {
                        str = "余额";
                    } else {
                        if (!str.contains("余额")) {
                            str += "+余额";
                        }
                    }
                } else if (afterPayTypeDetail.equals(PayTypeDetails.alipay)) {
                    if (StringUtils.isEmpty(str)) {
                        str = "支付宝";
                    } else {
                        if (!str.contains("支付宝")) {
                            str += "+支付宝";
                        }
                    }
                } else if (afterPayTypeDetail.equals(PayTypeDetails.weixin)) {
                    if (StringUtils.isEmpty(str)) {
                        str = "微信";
                    } else {
                        if (!str.contains("微信")) {
                            str += "+微信";
                        }
                    }
                } else if (afterPayTypeDetail.equals(PayTypeDetails.unionpay)) {
                    if (StringUtils.isEmpty(str)) {
                        str = "银联";
                    } else {
                        if (!str.contains("银联")) {
                            str += "+银联";
                        }
                    }
                } else if (afterPayTypeDetail.equals(PayTypeDetails.cash)) {// 老数据
                    str = "现金";
                } else if (afterPayTypeDetail.equals(PayTypeDetails.balance_cash)) {// 老数据
                    str = "余额+现金";
                } else if (afterPayTypeDetail.equals(PayTypeDetails.coupon_cash)) {// 老数据
                    str = "优惠券+现金";
                } else if (afterPayTypeDetail.equals(PayTypeDetails.coupon_sign)) {// 老数据
                    str = "优惠券+签单";
                } else if (afterPayTypeDetail.equals(PayTypeDetails.coupon_balance)) {// 老数据
                    str = "优惠券+余额";
                } else if (afterPayTypeDetail.equals(PayTypeDetails.unionpay)) {
                    if (StringUtils.isEmpty(str)) {
                        str = "银联";
                    } else {
                        if (!str.contains("银联")) {
                            str += "+银联";
                        }
                    }
                } else if (afterPayTypeDetail.equals(PayTypeDetails.bestpay)) {
                    if (StringUtils.isEmpty(str)) {
                        str = "翼支付";
                    } else {
                        if (!str.contains("翼支付")) {
                            str += "+翼支付";
                        }
                    }
                } else if (afterPayTypeDetail.equals(PayTypeDetails.cash)) {// 老数据
                    str = "现金";
                } else if (afterPayTypeDetail.equals(PayTypeDetails.balance_cash)) {// 老数据
                    str = "余额+现金";
                } else if (afterPayTypeDetail.equals(PayTypeDetails.coupon_cash)) {// 老数据
                    str = "优惠券+现金";
                } else if (afterPayTypeDetail.equals(PayTypeDetails.coupon_sign)) {// 老数据
                    str = "优惠券+签单";
                } else if (afterPayTypeDetail.equals(PayTypeDetails.coupon_balance)) {// 老数据
                    str = "优惠券+余额";
                }

            }

            if (!StringUtils.isEmpty(str)) {
                return str;
            } else {
                return null;
            }

        } else {
            return null;
        }
    }

    public String getPreAndAfterPayMoney() {

        String preAndAfterPayType = getPreAndAfterPayType();

        String str = "";
        if (null != preAndAfterPayType) {
            if (preAndAfterPayType.contains("优惠券")) {
                str += couponMoney + "+";
            }

            if (preAndAfterPayType.contains("签单") && preAndAfterPayType.contains("余额")) {
                if (preAndAfterPayType.indexOf("签单") == 0) {
                    str += signMoney + "+" + balanceMoney;
                } else if (preAndAfterPayType.indexOf("余额") == 0) {
                    str += balanceMoney + "+" + signMoney;
                }
            } else if (preAndAfterPayType.contains("签单")) {
                str += signMoney + "+";
            } else if (preAndAfterPayType.contains("余额")) {
                str += balanceMoney + "+";
            }

            if (preAndAfterPayType.contains("支付宝")) {
                str += alipayMoney + "+";
            }
            if (preAndAfterPayType.contains("微信")) {
                str += weixinMoney + "+";
            }
            if (preAndAfterPayType.contains("银联")) {
                str += unionpayMoney + "+";
            }
            if (preAndAfterPayType.contains("翼支付")) {
                str += bestpayMoney + "+";
            }
            if (preAndAfterPayType.contains("代付")) {
                str += cashMoney + "+";
            }
            if (preAndAfterPayType.contains("现金")) {// 老数据
                str += cashMoney + "+";
            }
        }

        if (!StringUtils.isEmpty(str)) {
            return str.substring(0, str.length() - 1);
        } else {
            return null;
        }

    }

    public enum PayType {
        /**
         * 现金
         */
        cash,
        /**
         * 签单
         */
        sign,
        /**
         * 余额
         */
        balance
    }

    public enum PayTypeDetails {

        /**
         * 现金(新版无)
         */
        cash,
        /**
         * 优惠劵+现金(新版无)
         */
        coupon_cash,
        /**
         * 余额+现金(新版无)
         */
        balance_cash,

        /**
         * 优惠券
         */
        coupon,

        /**
         * 代付
         */
        helppay,
        /**
         * 签单
         */
        sign,
        /**
         * 余额
         */
        balance,
        /**
         * 支付宝
         */
        alipay,
        /**
         * 微信
         */
        weixin,
        /**
         * 银联支付
         */
        unionpay,
        /**
         * 翼支付
         */
        bestpay,

        /**
         * 优惠劵+签单
         */
        coupon_sign,
        /**
         * 优惠劵+余额
         */
        coupon_balance,
        /**
         * 优惠劵+支付宝
         */
        coupon_alipay,
        /**
         * 优惠劵+微信
         */
        coupon_weixin,
        /**
         * 优惠券+银联支付
         */
        coupon_unionpay,
        /**
         * 优惠卷+翼支付
         */
        coupon_bestpay,
    }

    public enum OrderCarType {
        /**
         * 代驾
         */
        daijia,
        /**
         * 专车
         */
        zhuanche,

        /**
         * 租车
         */
        zuche
    }

    public enum OrderCarTypeDetail {
        /**
         * 酒后代驾
         */
        jhdj,
        /**
         * 商务代驾
         */
        swdj,
        /**
         * 马上用车
         */
        msyc,

        /**
         * 预约租车
         */
        yyzc
    }

}
